package com.company.chatting;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Auther Xue
 * @Date 2021/4/28
 * @Version 1.0
 * @Desc
 */
public class ChatService {
    public static void main(String[] args) {
        try {
            System.out.println("Socket服务器开始运行");
            ServerSocket serverSocket = new ServerSocket(9999);
            while (true){
                //接收客户端请求
                Socket socket = serverSocket.accept();
                new Thread(new ServerListen(socket)).start();
                new Thread(new ServerSend(socket)).start();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
